home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / gawk-3.000 / gawk-3 / gawk-3.0.0 / missing / strerror.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-19  |  1.2 KB  |  45 lines

  1. /*
  2.  * strerror.c --- ANSI C compatible system error routine
  3.  */
  4.  
  5. /* 
  6.  * Copyright (C) 1986, 1988, 1989, 1991 the Free Software Foundation, Inc.
  7.  * 
  8.  * This file is part of GAWK, the GNU implementation of the
  9.  * AWK Programming Language.
  10.  * 
  11.  * GAWK is free software; you can redistribute it and/or modify
  12.  * it under the terms of the GNU General Public License as published by
  13.  * the Free Software Foundation; either version 2 of the License, or
  14.  * (at your option) any later version.
  15.  * 
  16.  * GAWK is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  * GNU General Public License for more details.
  20.  * 
  21.  * You should have received a copy of the GNU General Public License
  22.  * along with this program; if not, write to the Free Software
  23.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
  24.  */
  25.  
  26. #if 0
  27. #include <stdio.h>
  28. #endif
  29.  
  30. extern int sys_nerr;
  31. extern char *sys_errlist[];
  32.  
  33. char *
  34. strerror(n)
  35. int n;
  36. {
  37.     static char mesg[30];
  38.  
  39.     if (n < 0 || n >= sys_nerr) {
  40.         sprintf(mesg, "Unknown error (%d)", n);
  41.         return mesg;
  42.     } else
  43.         return sys_errlist[n];
  44. }
  45.